package com.fita.wechat.dao;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.fita.entity.wallet.UserWallet;

/**
 * @description:
 * @author: 11200
 * @date: 2019/7/1
 */
@Dao("hibernate")
public interface DistributionRewardRecordDao {

    /**
     * 计算冻结代理分销金额
     * @param userWallet
     * @return
     */
    @Query("SELECT COALESCE(SUM(amount), 0) FROM DistributionRewardRecord WHERE disabled = false AND status = 'UNCONSUMED' AND targetUserWallet = :userWallet")
    public int calculateFreezeDistributionRewardAmount(@Variable("userWallet") UserWallet userWallet);
}
